package org.csu.mypetstore.service;

import org.csu.mypetstore.persistence.ManageCategoryMapper;
import org.csu.mypetstore.persistence.ManageItemMapper;
import org.csu.mypetstore.persistence.ManageProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class ManageCategoryService {

    @Autowired
    private ManageCategoryMapper manageCategoryMapper;
    @Autowired
    private ManageProductMapper manageProductMapper;
    @Autowired
    private ManageItemMapper manageItemMapper;

    public void insertCategory(String categoryId,String name,String description){
        manageCategoryMapper.insertCategory(categoryId,name,description);
    }

    public void updateCategory(String categoryId,String name,String description){
        manageCategoryMapper.updateCategory(categoryId,name,description);
    }

    public void deleteCategory(String categoryId){
        manageCategoryMapper.deleteCategory(categoryId);
    }

    public void insertProduct(String productId,String categoryId,String name,String description,String image){
        manageProductMapper.insertProduct(productId,categoryId,name,description,image);
    }

    public void updateProduct(String productId,String categoryId,String name,String description,String image){
        manageProductMapper.updateProduct(productId,categoryId,name,description,image);
    }

    public void deleteProduct(String productId){
        manageProductMapper.deleteProduct(productId);
    }

    public void insertItem(String itemId, String productId, BigDecimal listPrice, BigDecimal unitCost, int supplierId, String status, String attribute1, String attribute2, String attribute3, String attribute4, String attribute5){
        manageItemMapper.insertItem(itemId,productId,listPrice,unitCost,supplierId,status,attribute1,attribute2,attribute3,attribute4,attribute5);
    }

    public void updateItem(String itemId,String productId,BigDecimal listPrice,BigDecimal unitCost,int supplierId,String status,String attribute1,String attribute2,String attribute3,String attribute4,String attribute5){
        manageItemMapper.updateItem(itemId,productId,listPrice,unitCost,supplierId,status,attribute1,attribute2,attribute3,attribute4,attribute5);
    }


    public void deleteItem(String itemId){
        manageItemMapper.deleteItem(itemId);
    }

}
